import { Component , ViewChild , ElementRef } from '@angular/core';

/**
 * Generated class for the AudioPlayerComponent component.
 *
 * See https://angular.io/api/core/Component for more info on Angular
 * Components.
 */
@Component({
  selector: 'audio-player',
  templateUrl: 'audio-player.html'
})
export class AudioPlayerComponent {

  // @ViewChild('musicdom') audio : ElementRef;

  //实例化媒体对象
  private music;

  private music_dom;
  public audioPlayIcon : string = 'play';
  constructor(
  ) {
  }

  ngOnInit(){
    // this.music_dom = this.audio.nativeElement.firstElementChild;

    //加载musiccontrol服务 并创建musicControl对象
    
    
    
  }

  public audioToggle(){
    // this.music_dom.paused ? (this.audioPlayIcon = 'pause') && this.music_dom.play()  : (this.audioPlayIcon = 'play') && this.music_dom.pause() ;
    if(this.audioPlayIcon == 'play'){
      this.audioPlayIcon = 'pause';
    }else{
      this.audioPlayIcon = 'play';
    }
  }

}
